package com.gonsin.ta.logic.spring.spi;


import com.gonsin.ta.logic.node.Node;
import com.gonsin.ta.logic.node.NodeComponentProxy;
import com.gonsin.ta.logic.process.TaBus;
import com.gonsin.ta.logic.spring.ComponentScanner;
import org.springframework.stereotype.Component;

import java.util.Map;

/**
 * Spring环境容器上下文组件初始化实现
 * @author Bryan.Zhang
 * @since 2.6.11
 */
@Component
public class SpringContextCmpInit implements ContextCmpInit {
    @Override
    public void initCmp() {
        for (Map.Entry<String, Node> componentEntry : ComponentScanner.nodeComponentMap.entrySet()) {
            TaBus.addNode(componentEntry.getValue(), false);
        }
        for (Map.Entry<String, Node> componentEntry : ComponentScanner.nodeMethodMap.entrySet()) {
            TaBus.addNode(componentEntry.getValue(), false);
        }
    }

    @Override
    public int priority() {
        return 1;
    }
}
